package com.xrui.hbase.impl;

/**
 * Customizable parameters for RowScanners backed by an HBase scan.
 * Any parameters that are not set will default to HBase values.
 */
public final class HBaseScanOptions {
    /**
     * The number of rows to buffer on the client.
     */
    private Integer mClientBufferSize = null;
    /**
     * Whether servers should cache rows as they're retrieved.
     */
    private Boolean mCacheBlocks = null;

    /**
     * Creates a new HBaseScanOptions where all parameters will default to HBase values.
     */
    public HBaseScanOptions() {
    }

    /**
     * Returns the number of rows to request with each RPC,
     * or null if using the HBase default.
     *
     * @return The number of rows to request with each RPC.
     */
    public Integer getClientBufferSize() {
        return mClientBufferSize;
    }

    /**
     * Sets the number of rows that will be returned with each RPC when iterating
     * through a RowScanner.  If null, uses HBase default.
     *
     * @param bufferSize The number of rows to request with each RPC.
     */
    public void setClientBufferSize(Integer bufferSize) {
        mClientBufferSize = bufferSize;
    }

    /**
     * Returns whether requested rows are cached server-side,
     * or null if using the HBase default.
     *
     * @return Whether requested rows are cached server-side.
     */
    public Boolean getCacheBlocks() {
        return mCacheBlocks;
    }

    /**
     * Sets whether rows requested are cached server-side for future use.  If null, use HBase default.
     *
     * @param cacheBlocks Whether rows are cached server-side.
     */
    public void setCacheBlocks(Boolean cacheBlocks) {
        mCacheBlocks = cacheBlocks;
    }
}
